home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / asm / alib11b.zip / CODE1.ZIP / DISKINFO / DRVINFO.DOC < prev    next >
Text File  |  1994-10-04  |  3KB  |  94 lines

  1.  
  2. Question:
  3.  
  4. Is there any way to determine whether a disk drive (either a floppy
  5. disk drive or a hard disk drive) is local or networked?
  6.  
  7. Response:
  8.  
  9. Applications can issue MS-DOS INT 21H function 44H, subfunction 9
  10. (IOCTL Is Redirected Block) to determine whether a device is local
  11. (attached to the computer running the program) or remote (redirected
  12. to a network server). See this function's interface description on
  13. Pages 202-203 of the "Microsoft MS-DOS Programmer's Reference" for
  14. version 3.30 for complete details. Please note that currently, any
  15. printed interface description for this function is not entirely
  16. correct with respect to what is returned in the DX register. The
  17. following is the correct information regarding the return value in the
  18. DX register:
  19.  
  20.    DX = device attribute word
  21.    
  22.    bit 15 = 1         device is local
  23.    bit 12 = 1         device is remote  (per current documentation)
  24.    bit 9 = 1          device is shared
  25.  
  26. Listed below is an Assembler example invoking this function:
  27.  
  28.    .
  29.    .
  30.    .
  31.    mov  bl,[drive_no]
  32.    mov  ax,4409h
  33.    int  21h
  34.    jc   error          ; Invalid drive or function
  35.    test dx,1000h       ; Bit 12 set?
  36.    jnz  is_remote      ; Yes, have remote drive
  37.    .
  38.    .
  39.    .
  40.  
  41. Another further complication with using this particular function is
  42. the fact that this function does not work correctly in MS-DOS version
  43. 4.01. It does not always return the correct values in the DX register.
  44. This function seems to work correctly with Novell Networks, however.
  45.  
  46. Microsoft has confirmed this to be a problem in MS-DOS version 4.01.
  47. We are researching this problem and will post new information here as
  48. it becomes available.
  49.  
  50. Please also note that this problem does not occur in MS-DOS version
  51. 3.30. Because of this, we have included another example that will also
  52. allow you to determine whether a disk drive is local or remote. This
  53. second method consists of issuing the multiplex interrupt 2FH to see
  54. if the computer has a network redirector installed, and then issuing
  55. INT 21H, function 44H, subfunction 0DH, minor code 60H (IOCTL: Generic
  56. I/O Control for Block Devices: Get Device Parameters) to determine if
  57. error number 5 (access denied) is returned, which would indicate a
  58. network device. For example:
  59.  
  60.      .
  61.      .
  62.      .
  63. ; Establish whether computer has network redirector installed or not
  64.      mov  ax,1100h            ; Redirector code
  65.      int  2fh                 ; Issue multiplex INT
  66.      cmp  al,0ffh             ; 0ffh= redirector installed
  67.      jne  no_redirector       ; No redirector installed
  68.      mov  [net_redirector],TRUE   ; Flag redirector installed
  69.      .
  70.      .
  71.      .
  72. ; Get device parameters
  73.      mov  ax,440dh
  74.      mov  bl,[drive_no]
  75.      mov  cx,0860h
  76.      mov  dx,offset parm_block
  77.      int  21h
  78.      jnc  have_valid_device   ; Normal device and not remote
  79.  
  80. ; Error code returned in register AL, use to test for remote device
  81.      cmp  [net_redirector],FALSE
  82.      jz   perform_other_err_ck    ; No redirector installed
  83.  
  84. ; Network redirector installed
  85.      cmp  al,5           ; Access denied?
  86.      je   is_remote      ; Yes, have remote drive
  87.  
  88. ; Other errors like: device does not exist, etc.
  89. perform_other_err_ck:
  90.      .
  91.      .
  92.      .
  93.  
  94.